package br.com.spam.pipeline.instruction.i;

import br.com.spam.pipeline.core.Processor;

public class BEQ extends BTypeInstruction
{
	public static final int ID = 101;

	public BEQ(String instruction, Processor processor)
	{
		super(instruction, processor);
	}

	@Override
	protected int getBranchControlSignal()
	{
		return 0;
	}

	@Override
	protected int getBranchDestination()
	{
		return this.processor.getPC().getPersistedValue() + 4 + this.immediate();
	}

	@Override
	protected boolean shouldBranch(int rsValue, int rtValue)
	{
		return rsValue == rtValue;
	}

}
